execute store success score #redHasPlayer temp if entity @a[team=red]
execute store success score #blueHasPlayer temp if entity @a[team=blue]

execute if score #redHasPlayer temp matches 0 run return 1
execute if score #blueHasPlayer temp matches 0 run return 1